<template>
  <div>
    <div class="app-content">
      <el-page-header content="添加微信公众号" @back="$router.go(-1)" />
    </div>
    <div class="app-container">
      <dk-form :form-data="formData" @submit="onSubmit" />
    </div>
  </div>
</template>

<script>
import { getWechatCreateForm } from '@/api/platform/wechat'

export default {
  components: {},
  data() {
    return {
      formData: null
    }
  },
  mounted() {
    this.getWechatCreateForm()
  },
  methods: {
    getWechatCreateForm() {
      getWechatCreateForm().then((res) => {
        this.formData = res.data
      })
    },
    onSubmit(formData, res) {
      this.$msgbox
        .confirm('创建成功,是否跳转到平台')
        .then(() => {
          this.$router.push('/wechat?p=' + res.data.plaid)
        })
        .catch(() => {})
    }
  }
}
</script>

<style scoped></style>
